package com.yanfan.parking.service.impl;

import java.util.Arrays;
import java.util.List;
import com.yanfan.common.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yanfan.parking.mapper.NjCarWhiteInfoMapper;
import com.yanfan.parking.domain.NjCarWhiteInfo;
import com.yanfan.parking.service.INjCarWhiteInfoService;

/**
 * 黑白名单Service业务层处理
 *
 * @author genluo
 * @date 2024-11-05
 */
@Service
public class NjCarWhiteInfoServiceImpl extends ServiceImpl<NjCarWhiteInfoMapper, NjCarWhiteInfo> implements INjCarWhiteInfoService {
    @Autowired
    private NjCarWhiteInfoMapper njCarWhiteInfoMapper;


    /**
     * 查询黑白名单列表
     *
     * @param njCarWhiteInfo 黑白名单
     * @return 黑白名单
     */
    @Override
    public List<NjCarWhiteInfo> queryPageList(NjCarWhiteInfo njCarWhiteInfo) {
        LambdaQueryWrapper<NjCarWhiteInfo> lqw = buildQueryWrapper(njCarWhiteInfo);
        return njCarWhiteInfoMapper.selectList(lqw);
        //连表查询可用该方法，在此方法SQL语句上进行扩展
        //return njCarWhiteInfoMapper.queryPageList(njCarWhiteInfo);
    }

    /**
    * 分页查询条件
    * @return
    */
    private LambdaQueryWrapper<NjCarWhiteInfo> buildQueryWrapper(NjCarWhiteInfo bo) {
        LambdaQueryWrapper<NjCarWhiteInfo> lqw = Wrappers.lambdaQuery();
        lqw.like(StringUtils.isNotBlank(bo.getCarNum()), NjCarWhiteInfo::getCarNum, bo.getCarNum());
        return lqw;
    }



}
